export const bussiness = {
  state: () => ({
    node:{},
    data:{
      "ywdm": "",
      "zdtj": 0,
      "lcbz": "",
      "ywh": "",
      "qxdm": "",
      "slks": "",
      "slry": "政务服务",
      "wdbs": "鄂汇办",
      "zl": "",
      "yb": "",
      "lqfs": "",
      "zslb": "",
      "tzfs": "",
      "tzrxm": "",
      "tzrdh": "",
      "tzryddh": "",
      "tzrdzyj": "",
      "tzrtxdz": "",
      "jyjg": "",
      "bz": "",
      "xgry": [],
      "xgzxx": [],
      "dyqd":[],//单元清单
      "yyxx":[],//异议信息
      "dyxx":[],//抵押信息
      "fjxx": []
    },
    bdcqzs:"",
    currentStep:0,
    stepData: new Map(),
    bussinessInfo:{}
  }),
  getters:{
    savedData: state => {
      return state.stepData.get(state.currentStep)
    }
  },
  mutations:{
    INCREMENT_CURRENTSTEP:(state)=>{
      state.currentStep++;
    },
    DECREMENT_CURRENTSTEP:(state)=>{
      state.currentStep--;
    },
    SET_STEPDATA: (state,data) => {
      state.stepData.set(state.currentStep,data)
    },
    CLEAR_STEPDATA: (state) => {
      state.stepData.clear()
    },
    SET_BUSSINESSINFO: (state,bussinessInfo) =>{
      state.data.ywdm = bussinessInfo.ywdm
      state.bussinessInfo = bussinessInfo
    },
    SET_DATA: (state,data) =>{
      state.data = data
    },
    SET_YWH: (state,ywh) => {
      state.data.ywh = ywh;
    },
    SET_BZ: (state,bz) => {
      state.data.bz = bz;
    },
    SET_BDCQZS: (state,bdcqzs) => {
      state.bdcqzs = bdcqzs;
    },
    SET_XGRY: (state,xgry) =>{
      state.data.xgry = xgry
    },
    SET_ZL: (state,zl) =>{
      state.data.zl = zl
    },
    SET_FJXX: (state,fjxx) =>{
      state.data.fjxx = fjxx
    },
    SET_XGZXX: (state,xgzxx) =>{
      state.data.xgzxx = xgzxx
    },
    SET_DYQD: (state,dyqd) =>{
      state.data.dyqd = dyqd
    },
    SET_DYXX: (state,dyxx) =>{
      state.data.dyxx = dyxx
    },
    SET_YYXX: (state,yyxx) =>{
      state.data.yyxx = yyxx
    },
    SET_NODE: (state,node) =>{
      state.node = node
    }
  },
  actions:{
    setNode({ commit },node){
      commit('SET_NODE',node)
    },
    goNext({ commit },data){
      if(data){
        commit('SET_STEPDATA',data)
      }
      commit('INCREMENT_CURRENTSTEP')
    },
    goPrev({ commit }){
      commit('DECREMENT_CURRENTSTEP')
    },
    setBussinessInfo({ commit }, bussinessInfo){
      commit('SET_BUSSINESSINFO', bussinessInfo)
    },
    setData({ commit }, data) {
      commit('SET_DATA', data)
    },
    setYWH({ commit }, ywh) {
      commit('SET_YWH', ywh)
    },
    setBZ({ commit }, bz) {
      commit('SET_BZ', bz)
    },
    setBDCQZS({ commit }, bdcqzs) {
      commit('SET_BDCQZS', bdcqzs)
    },
    setXgry({ commit }, xgry) {
      commit('SET_XGRY', xgry)
    },
    setZl({ commit }, zl) {
      commit('SET_ZL', zl)
    },
    setDyqd({ commit }, dyqd) {
      commit('SET_DYQD', dyqd)
    },
    setFjxx({ commit }, fjxx) {
      commit('SET_FJXX', fjxx)
    },
    setXgzxx({ commit }, xgzxx) {
      commit('SET_XGZXX', xgzxx)
    },
    setDyxx({ commit }, dyxx) {
      commit('SET_DYXX', dyxx)
    },
    setYyxx({ commit }, yyxx) {
      commit('SET_YYXX', yyxx)
    },
    clear({ commit }){
      commit('CLEAR_STEPDATA')
    }
  }
}

